﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Slwy.Utility.Extensions
{
    public static class ServiceProviderServiceExtensions
    {
        /// <summary>
        /// 获取服务
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="value"></param>
        /// <returns></returns>
        public static T GetServiceEx<T>(this IServiceProvider value)
        {
            if (value == null)
                throw new ArgumentNullException(nameof(value));
            return (T) value.GetService(typeof(T));
        }
    }
}
